using AdmissionQA.Application.Common;
using AdmissionQA.Application.Dtos.Issue;
using AdmissionQA.Domain.Entities;

namespace AdmissionQA.Application.ServiceInterfaces;

/// <summary>
/// 常见问题服务接口
/// </summary>
public interface IIssueServices
{
    /// <summary>
    /// 创建常见问题
    /// </summary>
    /// <param name="issue">常见问题</param>
    /// <returns>创建结果</returns>
    Task<Result<string>> CreateIssueAsync(IssueDto issue);

    /// <summary>
    /// 批量创建常见问题
    /// </summary>
    /// <param name="issues">常见问题列表</param>
    /// <returns>创建结果</returns>
    Task<Result<string>> CreateIssuesAsync(IssuesDto issues);

    /// <summary>
    /// 根据ID获取常见问题
    /// </summary>
    /// <param name="id">常见问题ID</param>
    /// <returns>常见问题</returns>
    Task<Result<Issue>> GetIssueByIdAsync(Guid id);

    /// <summary>
    /// 获取所有常见问题
    /// </summary>
    /// <returns>常见问题列表</returns>
    Task<Result<IEnumerable<Issue>>> GetAllIssuesAsync();

    /// <summary>
    /// 分页获取常见问题
    /// </summary>
    /// <param name="pageIndex">页码</param>
    /// <param name="pageSize">页大小</param>
    /// <returns>分页结果</returns>
    Task<Result<IEnumerable<Issue>>> GetPagedIssuesAsync(int pageIndex = 0, int pageSize = 10);

    /// <summary>
    /// 根据问题内容搜索常见问题
    /// </summary>
    /// <param name="question">问题内容</param>
    /// <returns>匹配的常见问题列表</returns>
    Task<Result<IEnumerable<Issue>>> SearchIssuesByQuestionAsync(string question);

    /// <summary>
    /// 更新常见问题
    /// </summary>
    /// <param name="id">常见问题ID</param>
    /// <param name="issue">常见问题</param>
    /// <returns>更新结果</returns>
    Task<Result<string>> UpdateIssueAsync(Guid id, IssueDto issue);

    /// <summary>
    /// 删除常见问题
    /// </summary>
    /// <param name="id">常见问题ID</param>
    /// <returns>删除结果</returns>
    Task<Result<string>> DeleteIssueAsync(Guid id);

    /// <summary>
    /// 批量删除常见问题
    /// </summary>
    /// <param name="ids">常见问题ID列表</param>
    /// <returns>删除结果</returns>
    Task<Result<string>> DeleteIssuesAsync(IEnumerable<Guid> ids);

    /// <summary>
    /// 获取常见问题总数
    /// </summary>
    /// <returns>常见问题总数</returns>
    Task<int> GetIssueCountAsync();

    /// <summary>
    /// 基于向量相似度搜索常见问题
    /// </summary>
    /// <param name="text">查询文本</param>
    /// <param name="topK">返回最相似的前K个</param>
    /// <returns>最相似的常见问题列表</returns>
    Task<Result<IEnumerable<Issue>>> SearchIssuesByEmbeddingAsync(string text, int topK = 5);
}
